Skip to content

Conversation

@gilgameshfreedom
Copy link

Description

fully-random may prevent NAT traversal for applications running in Kubernetes. As an example of such anapplication is Tailscale, which by default tries to establish a direct peer-to-peer connection between endpoints. fully-random mode makes it impossible, so Tailscale has to use indirect connections through its DERP servers, which affects network performance.

This should fix #2273

This is described in more detail here - tailscale/tailscale#11427

Todos

  • Tests
  • Documentation
  • Release note

Release Note

iptables/nftables: add option to disable fully-random mode for MASQUERADE

fully-random may prevent NAT traversal for applications running
in Kubernetes. As an example of such anapplication is Tailscale,
which by default tries to establish a direct peer-to-peer connection
between endpoints. fully-random mode makes it impossible, so Tailscale
has to use indirect connections through its DERP servers, which
affects network performance.

resolves flannel-io#2273
@gilgameshfreedom
Copy link
Author

@ksubrmnn or @madhanrm or @rajatchopra could you please review the PR

@gilgameshfreedom
Copy link
Author

@rbrtbnfgl
Copy link
Contributor

Are you using tailscale inside of a pod? The nat rule should applied only on traffic from pods to external destination.

@gilgameshfreedom
Copy link
Author

Are you using tailscale inside of a pod? The nat rule should applied only on traffic from pods to external destination.

Hi @rbrtbnfgl

Yes, we're using Tailscale operator to expose a Kubernetes cluster workload to tailnet (cluster ingress) - https://tailscale.com/kb/1439/kubernetes-operator-cluster-ingress

Tailscale operator creates a deployment for every exposed service, so answering to your question it's running in Kubernetes and what's why it's affected by the NAT rules created by CNI.

@gilgameshfreedom
Copy link
Author

Hi @philips, @rajatchopra and @tomdee

The PR has already been approved by the reviewers. Could you please review it and give the final approval so we can merge it into master?

@rbrtbnfgl
Copy link
Contributor

rbrtbnfgl commented Sep 19, 2025

I can merge it. Please don't randomly tag people some of them aren't actively working on the project anymore.

@gilgameshfreedom
Copy link
Author

I can merge it. Please don't randomly tag people some of them aren't actively working on the project anymore.

Hi @rbrtbnfgl. I didn't do it randomly, I've just followed the OWNERS file. If some people from OWNERS aren't actively working on the project anymore should they probably be excluded from the file? Otherwise, it will confuse newcomers like me.

@rbrtbnfgl
Copy link
Contributor

You need to fix the lint check before we can merge.

@gilgameshfreedom
Copy link
Author

You need to fix the lint check before we can merge.

Hi @rbrtbnfgl. I have fixed the lint check.

@rbrtbnfgl rbrtbnfgl merged commit 1808f99 into flannel-io:master Sep 30, 2025
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow turning off fully-random masquerade flag

3 participants